clear
set more off


use "$statadir/takeup_by_ppp", clear

local any_ertcstr "On original returns"
local any_amendstr "On amended returns"

foreach var in any_ertc any_amend {
	twoway connected `var' date if has_ppp == 1 || ///
		connected `var' date if has_ppp == 0, lpattern("--") ///
		msymbol(circle_hollow) ///
		legend(order(1 "Observed to have PPP loan" 2 "All others")) ///
		scheme(s1color) xtitle("Date") ytitle("Share taking up ERC") ///
		title("``var'str'")
                                                
	graph save g`var'.gph, replace
                
}

grc1leg gany_ertc.gph gany_amend.gph, scheme(s1color) leg(gany_ertc.gph) ycommon
graph display, ysize(3) xsize(`=16/3')



graph export "$outdir/figures/takeup_by_ppp.eps", replace


bys has_ppp: sum any_ertc if inrange(date,tq(2021q1),tq(2021q3))
bys has_ppp: sum any_amend if date <= tq(2021q3)
